package com.hd.shiro2204.config;

import com.hd.shiro2204.filter.MyFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.servlet.Filter;

@Configuration
public class FilterConfig {
    @Bean
    public FilterRegistrationBean<MyFilter> myFilterFilterRegistrationBean(MyFilter myFilter){
        FilterRegistrationBean<MyFilter> registrationBean = new FilterRegistrationBean<>();
        //过滤所有请求
        registrationBean . addUrlPatterns("/*");
        //没贸处理请求的filter对象
        registrationBean. setFilter(myFilter) ;
        //[没置filter的位置,数越小越考前
        registrationBean.setOrder(Integer .MIN_VALUE) ;
        return registrationBean;


    }
}
